//
//  TMTradeCollectCell.m
//  国学商家管理
//
//  Created by Tao Li on 2018/7/2.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "TMTradeCollectCell.h"
#import "TMMyCourseModel.h"
#import "TMCollectionModel.h"
@implementation TMTradeCollectCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.layer.borderWidth = 1.0f;
    self.layer.borderColor = [UIColor hx_colorWithHexRGBAString:@"#EEEEEE"].CGColor;
    self.tradeImage.contentMode = UIViewContentModeScaleAspectFill;
    self.tradeImage.clipsToBounds = YES;
}
- (void)setModel:(TMMyCourseModel *)model{
    _model = model;
    self.editBtn.hidden = YES;
    self.tradeName.text = model.name;
    self.teacherName.text = [NSString stringWithFormat:@"任课教师:%@", model.tea_name];
    self.addressName.text = [NSString stringWithFormat:@"地址:%@", model.addr];
    [self.tradeImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithBaseUrl:model.photo[0]]] placeholderImage:kPlaceholder];
}
- (void)setCollModel:(TMCollectionModel *)collModel{
    _collModel = collModel;
    //self.editBtn.hidden = YES;
    self.tradeName.text = collModel.name;
    self.teacherName.text = [NSString stringWithFormat:@"任课教师:%@", collModel.tea_name];
    self.addressName.text = [NSString stringWithFormat:@"地址:%@", collModel.addr];
    [self.tradeImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithBaseUrl:collModel.photo[0]]] placeholderImage:kPlaceholder];
}
- (IBAction)editBtnAction:(UIButton *)sender {
    sender.selected = !sender.selected;
    if (self.block) {
        self.block(sender.selected);
    }
}
@end
